<?php 

	class UserController
	{
		public function index(Request $request)
		{
			$request->all();
		}

		public function delete(Request $request, DB $db, Test $test)
		{
			$request->only();
			$db->delete();
			$test->abc();
		}
	}

	class Request 
	{
		public function all()
		{
			echo '获取所有的参数....';
		}

		public function only()
		{
			echo '获取部分参数....<hr>';
		}
	}

	class DB
	{
		public function delete()
		{
			echo '进行数据删除...<hr>';
		}
	}

	class Test
	{
		public function abc()
		{
			echo '我是Test下的一个方法.....<br>';
		}
	}

	$className = 'UserController';//类名
	$methodName = 'delete';//方法名

	// 创建反射对象
	$class = new ReflectionClass($className);
	$method = new ReflectionMethod($className, $methodName);

	//获取方法的参数信息
	$params = $method->getParameters();


	$objParams = [];
	//根据参数获取类名信息
	foreach ($params as $key => $value) {
		$cname = $value->getClass()->getName();
		$objParams[] = (new ReflectionClass($cname))->newInstance();
	}

	//根据对象参数进行方法调用
	$method->invokeArgs($class->newInstance(), $objParams);


 ?>